<template>
  <div>
    <van-cell-group>
      <van-cell center title="停止服务（仅管理员除外）">
        <van-switch checked="" bind:change="onChange" />
      </van-cell>
      <van-field
        @change="changeVal_site"
        :value="admins"
        label="管理员名单"
        type="textarea"
        placeholder="一行一个管理员"
        input-class="textarea"
        autosize
        required
      />
      <div class="btnm" >
        <van-button type="info" @click="updateGuo" block>提交</van-button>
      </div>

    </van-cell-group>
    <van-dialog id="van-dialog" />
  </div>
</template>

<script>
  export default {
    data () {
      return {
        admins:""
      }
    },
    mounted() {
      this.loadadmin()
    },
    methods: {
      getguoppage(){
        wx.navigateTo({
          url: "/pages/options_guopin/main"
        })
      },

      loadadmin(){
        let t = this
        wx.cloud.callFunction({
          name: 'options',
          data:{
            want:"adminlist"
          },
          success(res) {
            if(res){
              t.admins = ""
              for (let i=0;i<res.result.data.name.length;i++){
                if(i==res.result.data.name.length){
                  t.admins+=res.result.data.name[i]
                }else{
                  t.admins+=res.result.data.name[i]+"\n"
                }
              }
            }
          }
        })
      }


    },

    created () {
      // let app = getApp()
    }
  }
</script>

<style >
  .btnm{padding: 32rpx}

  .textarea{
    min-height: 222rpx!important;
    padding-top: 20rpx!important;
  }

  page {
    background-color: #fff;
  }



  .tr {
    width: 100%;
    display: flex;
    justify-content: space-between;
  }

  .th, .td {
    padding: 10px;
    border-bottom: 1px solid #dadada;
    border-right: 1px solid #dadada;
    text-align: center;
    width: 100%;
  }

  .th {
    font-weight: 400;
    background-color: #dadada;
  }

</style>
